﻿Imports System.Xml.Serialization

<XmlRoot("ByteArray")> Public Class tagByteArray
    Inherits tagBase

    <XmlElement("Value")> Public Value As New List(Of tagByte)

    Public Sub New()

    End Sub

    Friend Sub New(ByVal str As System.IO.Stream)
        MyBase.New(str)

        Dim Len As UInt32
        Len = BitConverter.ToUInt32(ReadBytesFromStream(str, 4).Reverse.ToArray, 0)

        For i = 0 To Len - 1
            Dim NewTag As New tagByte
            Dim b As Byte
            b = ReadBytesFromStream(str, 1)(0)
            If b < 128 Then
                NewTag.Value = CType(b, SByte)
            Else
                NewTag.Value = CType(b - 256, SByte)
            End If
            Value.Add(NewTag)
        Next
    End Sub
End Class
